<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resource/bootstrap4/css/bootstrap.css">
    <script src="${pageContext.request.contextPath}/resource/js/jquery-3.2.1.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap4/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/resource/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
    <form>
        关键字：<input name="keyword" value="${arg.keyword}">
        <br>
        源人数：<input name="min" value="${arg.min}">~<input name="max" value="${arg.max}">
        <br>
        部门ID：<input name="deptId" value="${arg.deptId}">
        <br>
        <input name="pageNum" type="hidden" value="${arg.pageNum}">
        <br>
    </form>
    <button type="button" onclick="searchIt()">查询</button>
    <hr>
    <table class="table">
        <tr>
            <td>主键</td>
            <td>部门ID</td>
            <td>部门编号</td>
            <td>承租房间</td>
            <td>房产信息</td>
            <td>小区名</td>
            <td>居住人数</td>
            <td>租客ID</td>
            <td>租客姓名</td>
            <td>租客手机号</td>
            <td>租客紧急联系号</td>
            <td>租客证件号</td>
            <td>租客联系地址</td>
            <td>出房人姓名</td>
        </tr>
        <c:forEach items="${list}" var="c">
            <tr>
                <td>${c.id}</td>
                <td>${c.deptId}</td>
                <td>${c.deptNo}</td>
                <td>${c.roomName}</td>
                <td>${c.houseName}</td>
                <td>${c.premiseName}</td>
                <td>${c.peopleNum}</td>
                <td>${c.tenantId}</td>
                <td>${c.tenantName}</td>
                <td>${c.tenantPhone}</td>
                <td>${c.tenantEmergencyPhone}</td>
                <td>${c.tenantCardNo}</td>
                <td>${c.tenantContactAddress}</td>
                <td>${c.cfUserName}</td>
            </tr>
        </c:forEach>
        <tr>
            <td>
                <button type="button" onclick="goPage(1)">首页</button>
                <button type="button" onclick="goPage(${arg.pageNum-1!=0?arg.pageNum-1:arg.pageNum})">上一页</button>
                <button type="button" onclick="goPage(${arg.pageNum+1})">下一页</button>
            </td>
        </tr>
    </table>
    <script>
        $(function () {

        });

        function goPage(pageNum) {
            $("[name='pageNum']").val(pageNum);
            sub();
        }

        function searchIt() {
            $("[name='pageNum']").val(1);
            sub();
        }

        function sub() {
            location = "${pageContext.request.contextPath}/contract/list?"+$("form").serialize();
        }
    </script>
</body>
</html>
